using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GameSite.Models.Mapping
{
    public class DownLoadMap : EntityTypeConfiguration<DownLoad>
    {
        public DownLoadMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.PlatForm)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Version)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.LastUpdateTime)
                .IsRequired();

            this.Property(t => t.Size)
                .IsRequired();

            this.Property(t => t.Price)
                .IsRequired();

            this.Property(t => t.ImageUrl)
                .IsRequired()
                .HasMaxLength(2000);

            this.Property(t => t.Detail)
                .IsRequired();

            this.Property(t => t.StoreUrl)
                .IsRequired()
                .HasMaxLength(2000);
            this.Property(t => t.DownloadUrl)
                .IsRequired()
                .HasMaxLength(2000);

            this.Property(t => t.SlideImage1)
                .HasMaxLength(2000);

            this.Property(t => t.SlideImage2)
                .HasMaxLength(2000);

            this.Property(t => t.SlideImage3)
                .HasMaxLength(2000);

            this.Property(t => t.SlideImage4)
                .HasMaxLength(2000);

            this.Property(t => t.SlideImage5)
                .HasMaxLength(2000);

            this.Property(t => t.SlideImage6)
                .HasMaxLength(2000);

            // Table & Column Mappings
            this.ToTable("DownLoad");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.PlatForm).HasColumnName("PlatForm");
            this.Property(t => t.Version).HasColumnName("Version");
            this.Property(t => t.LastUpdateTime).HasColumnName("LastUpdateTime");
            this.Property(t => t.Size).HasColumnName("Size");
            this.Property(t => t.Price).HasColumnName("Price");
            this.Property(t => t.ImageUrl).HasColumnName("ImageUrl");
            this.Property(t => t.Detail).HasColumnName("Detail");
            this.Property(t => t.StoreUrl).HasColumnName("StoreUrl");
            this.Property(t => t.DownloadUrl).HasColumnName("DownloadUrl");
            this.Property(t => t.SlideImage1).HasColumnName("SlideImage1");
            this.Property(t => t.SlideImage2).HasColumnName("SlideImage2");
            this.Property(t => t.SlideImage3).HasColumnName("SlideImage3");
            this.Property(t => t.SlideImage4).HasColumnName("SlideImage4");
            this.Property(t => t.SlideImage5).HasColumnName("SlideImage5");
            this.Property(t => t.SlideImage6).HasColumnName("SlideImage6");
            this.Property(t => t.GameIntroID).HasColumnName("GameIntroID");
        }
    }
}
